<template>
	<view class="bidding_betwn com" v-if="item&&item.user">
		<view class="bidding_user" @click.stop="$emit('userPage',item)">
			<u-avatar v-if="item.user.avatar" :size="70" :src="toImages(item.user.avatar)"></u-avatar>
		</view>
		<view style="flex: 1;" class="flex">
			<view>
				<view class="userName">
					<text class="bidding_user_text">{{ item.user[$t('item.user.username')] }}</text>
				</view>
				<view class="flex">
					<image v-if="item.user.label&&item.user.label.length!=0&&item.user.label[0]"
						:src="toImages(item.user.label[0].url)" class="country_icon"
						style="padding-left:0;width: 40rpx;height:24rpx"></image>
				</view>
			</view>
			<view class="chat" v-if="type == 2&&!hidechat" @click.stop="$emit('communicates',item)">
				<text class="text_1">
					{{ $t('即时沟通') }}
				</text>
			</view>
		</view>
	</view>
</template>

<script>
	import FromToCountry from '@/components/FromToCountry.vue'
	import Tag from '@/components/Tag.vue'
	import {
		IMAGE_URL,
		HTTP_IMG_UTL
	} from "@/config/app";
	export default {
		name: "UserByList",
		props: {
			hidechat: {
				type: Boolean
			},
			item: {
				type: Object,
				default: {},
			},
			type: {
				type: String | Number,
				default: '1',
			},
		},
		computed: {
			toImages() {
				return (src) => {
					return this.IMAGE_URL + src
				}
			},
			storeImages() {
				return (sum, images) => images.length > sum ? images.splice(sum) : images
			},
		},
		data() {
			return {
				IMAGE_URL
			};
		}
	}
</script>
<style lang="scss" scoped>
	.chat {}

	.bidding_betwn {
		display: flex;
		// justify-content: space-between;
		align-items: center;

		.chat {
			transform: translateY(0rpx);
		}

		.userName {

			.bidding_user_text {
				display: block;
				padding-left: 0;
				color: #3d3d3d;
				font-size: 24rpx;
				margin-bottom: 8rpx;
				line-height: 30rpx;
				max-height: 60rpx;
				overflow: hidden;
			}

			.country_icon {
				padding-left: 0;
			}
		}

		.flex {
			display: flex;
			justify-content: space-between;
			align-items: center;
		}


		.bidding_user {
			display: flex;
			flex-direction: row;
			align-items: center;
			// padding: $my-padding-20;
			margin-right: 24rpx;


			//头像大小
			.bidding_user_image {
				padding-left: $my-padding-10;
				height: 50rpx;
				width: 50rpx
			}

			//用户图标
			.bidding_user_icon {
				padding-left: $my-padding-10;
				height: 35rpx;
				width: 35rpx;
			}
		}
	}
</style>